package com.jbp.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jbp.model.Banner;
import com.jbp.service.BannerService;
import com.jbp.utils.PageUtils;
import com.jbp.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Map;
import java.util.Queue;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import springfox.documentation.annotations.ApiIgnore;

/**
 * (Banner)表控制层
 * @author cc
 * @since 2020-06-30 22:48:04
 */
@Api(tags ="APP接口--Banner" ,hidden = true)
@ApiIgnore
@RestController
@RequestMapping("banner")
public class BannerController {
    @Autowired
    private BannerService bannerService;

    /** 列表 */
    @ApiOperation(value="列表")
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功",response = Banner.class),
            @ApiResponse(code = 201,message = "返回失败信息")
    })
    @GetMapping("/list")
    public R list(@RequestParam(required = false)Integer type){
        if (type==null) {
            return R.ok(bannerService.list(new QueryWrapper<Banner>()
                    .eq("del",0)));
        }
        return R.ok(bannerService.list(new QueryWrapper<Banner>()
                .eq("type", type)
                .eq("del",0)
        ));
    }

}